Skip to content

cttp: streaming HTTP client responses via x-urbit-stream header#976

Draft
niblyx-malnus wants to merge 2 commits intourbit:developfrom
niblyx-malnus:tlv/iris-progress-cancel
Draft

cttp: streaming HTTP client responses via x-urbit-stream header#976
niblyx-malnus wants to merge 2 commits intourbit:developfrom
niblyx-malnus:tlv/iris-progress-cancel

Conversation

@niblyx-malnus
Copy link

@niblyx-malnus niblyx-malnus commented Mar 3, 2026

Summary

Adds opt-in streaming mode to iris (cttp) HTTP client. When a request includes
an x-urbit-stream header, the runtime sends response data incrementally as
%start / %continue / %cancel events instead of buffering the entire body
into a single %finished event.

Motivation

The buffered response model requires the entire HTTP response to complete before
Arvo sees any data. This doesn't work for Server-Sent Events (SSE) streams,
which can stay open indefinitely.

How it works

  1. Hoon-side code adds an x-urbit-stream: true header to the %request card
  2. The runtime detects and strips this header before sending the request
  3. Instead of accumulating body chunks, each chunk is dispatched immediately:
    • %start — headers arrived (with status code and response headers)
    • %continue — body chunk arrived (with optional data and fin flag)
    • %cancel — connection error (replaces the fake 504 in buffered mode)
  4. Existing buffered behavior is completely unchanged for requests without the header

@niblyx-malnus niblyx-malnus force-pushed the tlv/iris-progress-cancel branch from 33cc7d5 to a2e40f5 Compare March 3, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant